#include <cstdio>
#include <cstring>

int p[ 10001 ], h[ 10001 ];

int main( )
{
    int i, j, t, n, q;
    char c;
    bool flag;
    scanf("%d", &t);
    while ( t-- )
    {
        scanf("%d", &n);
        getchar( );
        i = 0;
        q = 0;
        while ( ( c = getchar( ) ) != '\n' )
        {
            if ( c == ' ' )
            {
                p[ i ] = q;
                h[ q ] = i++;
                q = 0;
            }
            else
                q = q * 10 + c - '0';
        }
        p[ i ] = q; h[ q ] = i++;
        flag = false;
        for ( i = 0; i < n - 2 && !flag; i++ )
            for ( j = i + 2; j < n && !flag; j++ )
            {
                q = p[ i ] + p[ j ];
                if ( !( q & 1 ) && h[ q / 2 ] > i && h[ q / 2 ] < j )
                    flag = true;
            }
        if ( flag )
            puts("Y");
        else
            puts("N");
    }
    return 0;
}
